<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  
  <meta name="generator" content="Hugo 0.98.0" />

  
  <meta name="description" content="走在通往幸福的路上">
  

  
  <link rel="apple-touch-icon" sizes="180x180" href="https://blog.v5u.win/apple-touch-icon.png">

  
  <link rel="icon" type="image/png" sizes="32x32" href="https://blog.v5u.win/favicon-32x32.png">

  
  <link rel="icon" type="image/png" sizes="16x16" href="https://blog.v5u.win/favicon-16x16.png">

  
  <link rel="manifest" href="https://blog.v5u.win/site.webmanifest">

  
  <link rel="mask-icon" href="https://blog.v5u.win/safari-pinned-tab.svg" color="">

  <meta name="msapplication-TileColor" content="">

  <meta name="theme-color" content="">

  
  <link rel="stylesheet" href="https://blog.v5u.win/css/bootstrap.min.css" />

  
  <title>flutter安装 | 为吾优</title>
  

  <style>
body {
  min-width: 300px;
}

.custom-navbar {
  margin-bottom: 1em;
  height: 60px;
}

.custom-navbar a {
  display: inline-block; 
  padding: 18px 0;
  margin-right: 1em; 
  font-weight: bold; 
}

.custom-navbar a:hover,
.custom-navbar a:focus {
  text-decoration: none; 
}

@media print {
  .custom-navbar {
    display: none;
  }
}

article {
  padding-bottom: 1em;
}

img {
  max-width: 100%;
}


body {
  background-color: #fff;
}



body {
  color: #212529;
}



a {
  color: #007bff;
}



a:hover,
a:focus {
  color: #0056b3;
}



.custom-navbar {
  background-color: #212529;
}



.custom-navbar a {
  color: rgba(255,255,255,.75);
}



.custom-navbar a:hover,
.custom-navbar a:focus {
  color: rgba(255,255,255,1);
}



.container {
  max-width: 800px;
}





</style>
</head>

<body>
  <nav class="custom-navbar">
  <div class="container">
    
    <a href="/">文章</a>
    
    <a href="/tags/">标签</a>
    
    <a href="/about/">关于</a>
    
    <a href="/index.xml">RSS</a>
    
  </div>
</nav>
  
  <div class="container">
    <article>
      <h1>flutter安装</h1>
<p>flutter安装</p>
<ol>
<li>git 下载 flutter：git clone -b stable <a href="https://github.com/flutter/flutter.git">https://github.com/flutter/flutter.git</a></li>
<li>配置.zshrc</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>export PATH<span style="color:#f92672">=</span>/Users/fanjinlong/dev/flutter/flutter/bin:$PATH
</span></span><span style="display:flex;"><span>export ANDROID_HOME<span style="color:#f92672">=</span>/Users/fanjinlong/Library/Android/sdk
</span></span><span style="display:flex;"><span>export PATH<span style="color:#f92672">=</span><span style="color:#e6db74">${</span>PATH<span style="color:#e6db74">}</span>:<span style="color:#e6db74">${</span>ANDROID_HOME<span style="color:#e6db74">}</span>/tools
</span></span><span style="display:flex;"><span>export PATH<span style="color:#f92672">=</span><span style="color:#e6db74">${</span>PATH<span style="color:#e6db74">}</span>:<span style="color:#e6db74">${</span>ANDROID_HOME<span style="color:#e6db74">}</span>/platform-tools
</span></span><span style="display:flex;"><span>export PUB_HOSTED_URL<span style="color:#f92672">=</span>https://pub.flutter-io.cn
</span></span><span style="display:flex;"><span>export FLUTTER_STORAGE_BASE_URL<span style="color:#f92672">=</span>https://storage.flutter-io.cn	
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 记得配置完了，执行下 source ~/.zshrc 更新环境变量</span>
</span></span></code></pre></div><ol start="3">
<li>命令行执行 <code>flutter doctor</code> 检查环境配置情况。</li>
<li>在 Android studio 中添加插件 flutter + dart</li>
<li>根据<code>flutter doctor</code> 解决所有必要的问题</li>
<li>运行 flutter run</li>
<li>如果不能运行，查看报错，比如 <code>flutter emulators</code>——&gt;<code>flutter emulators --launch Pixel_2_API_29</code>——&gt; <code>flutter run</code></li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>Running <span style="color:#e6db74">&#34;flutter pub get&#34;</span> in flutter_app...                         3.4s
</span></span><span style="display:flex;"><span>Using hardware rendering with device Android SDK built <span style="color:#66d9ef">for</span> x86. If you get graphics artifacts, consider
</span></span><span style="display:flex;"><span>enabling software rendering with <span style="color:#e6db74">&#34;--enable-software-rendering&#34;</span>.
</span></span><span style="display:flex;"><span>Launching lib/main.dart on Android SDK built <span style="color:#66d9ef">for</span> x86 in debug mode...
</span></span><span style="display:flex;"><span>Initializing gradle...
</span></span><span style="display:flex;"><span>540.5s <span style="color:#f92672">(</span>!<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Resolving dependencies...
</span></span><span style="display:flex;"><span>  634.0s <span style="color:#f92672">(</span>!<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Running Gradle task <span style="color:#e6db74">&#39;assembleDebug&#39;</span>...
</span></span><span style="display:flex;"><span>Running Gradle task <span style="color:#e6db74">&#39;assembleDebug&#39;</span>... Done                       147.6s <span style="color:#f92672">(</span>!<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>Built build/app/outputs/apk/debug/app-debug.apk.
</span></span><span style="display:flex;"><span>Installing build/app/outputs/apk/app.apk...                         2.9s
</span></span><span style="display:flex;"><span>D/EGL_emulation<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: eglMakeCurrent: 0xd681a0c0: ver <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>tinfo 0xd680f300<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>D/eglCodecCommon<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: setVertexArrayObject: set vao to <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">0</span>
</span></span><span style="display:flex;"><span>Syncing files to device Android SDK built <span style="color:#66d9ef">for</span> x86...
</span></span><span style="display:flex;"><span>I/OpenGLRenderer<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: Davey! duration<span style="color:#f92672">=</span>788ms; Flags<span style="color:#f92672">=</span>1, IntendedVsync<span style="color:#f92672">=</span>1386986507632, Vsync<span style="color:#f92672">=</span>1386986507632, OldestInputEvent<span style="color:#f92672">=</span>9223372036854775807, NewestInputEvent<span style="color:#f92672">=</span>0, HandleInputStart<span style="color:#f92672">=</span>1386993436664, AnimationStart<span style="color:#f92672">=</span>1386993471165, PerformTraversalsStart<span style="color:#f92672">=</span>1386993474034, DrawStart<span style="color:#f92672">=</span>1387600641641, SyncQueued<span style="color:#f92672">=</span>1387601916409, SyncStart<span style="color:#f92672">=</span>1387607434150, IssueDrawCommandsStart<span style="color:#f92672">=</span>1387609441987, SwapBuffers<span style="color:#f92672">=</span>1387725240730, FrameCompleted<span style="color:#f92672">=</span>1387780735364, DequeueBufferDuration<span style="color:#f92672">=</span>31361000, QueueBufferDuration<span style="color:#f92672">=</span>260000,
</span></span><span style="display:flex;"><span>I/Choreographer<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: Skipped <span style="color:#ae81ff">46</span> frames!  The application may be doing too much work on its main thread.     D/EGL_emulation<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: eglMakeCurrent: 0xd681a300: ver <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>tinfo 0xd680f3d0<span style="color:#f92672">)</span>                                 D/eglCodecCommon<span style="color:#f92672">(</span> 4282<span style="color:#f92672">)</span>: setVertexArrayObject: set vao to <span style="color:#ae81ff">0</span> <span style="color:#f92672">(</span>0<span style="color:#f92672">)</span> <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">0</span>                                            Syncing files to device Android SDK built <span style="color:#66d9ef">for</span> x86...            183,943ms <span style="color:#f92672">(</span>!<span style="color:#f92672">)</span>
</span></span><span style="display:flex;"><span>🔥  To hot reload changes <span style="color:#66d9ef">while</span> running, press <span style="color:#e6db74">&#34;r&#34;</span>. To hot restart <span style="color:#f92672">(</span>and rebuild state<span style="color:#f92672">)</span>, press <span style="color:#e6db74">&#34;R&#34;</span>.
</span></span><span style="display:flex;"><span>An Observatory debugger and profiler on Android SDK built <span style="color:#66d9ef">for</span> x86 is available at:
</span></span><span style="display:flex;"><span>http://127.0.0.1:52933/6NColDWV2ps<span style="color:#f92672">=</span>/
</span></span><span style="display:flex;"><span>For a more detailed help message, press <span style="color:#e6db74">&#34;h&#34;</span>. To detach, press <span style="color:#e6db74">&#34;d&#34;</span>; to quit, press <span style="color:#e6db74">&#34;q&#34;</span>.
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>Initializing hot reload...
</span></span><span style="display:flex;"><span>Reloaded <span style="color:#ae81ff">0</span> of <span style="color:#ae81ff">455</span> libraries in 956ms.
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>To run an emulator, run <span style="color:#e6db74">&#39;flutter emulators --launch &lt;emulator id&gt;&#39;</span>.
</span></span><span style="display:flex;"><span>To create a new emulator, run <span style="color:#e6db74">&#39;flutter emulators --create [--name xyz]&#39;</span>	
</span></span></code></pre></div>
    </article>
  </div>

  
  
  

  
</body>

</html>